var myMooFlowPage = {
	
		start: function(){
	
			mf = new MooFlow($('scanlist_content'), {
				startIndex: 0,
				useSlider: true,
				useAutoPlay: false,
				useCaption: true,
				useResize: false,
				useMouseWheel: true,
				useKeyInput: true
			});
			mf.loadData();
			$('playwindow_background_center').tween('opacity', 0);
			$('playwindow_background_center').setStyle('z-index', 1);
            loadImages();
            if (pageWidth() <= 1250)
            {
                $("page_background_regist_filter").setStyles({'width':'1250px'});
                $("page_background_regist").setStyles({'width':'1250px'});
            }
            else
            {
                $("page_background_regist_filter").setStyles({'width':'100%'});
                $("page_background_regist").setStyles({'width':'100%'});
            }
            if (pageHeight() <= 660)
            {
                $("page_background_regist_filter").setStyles({'height':'660px'});
                $("page_background_regist").setStyles({'height':'660px'});
            }
            else
            {
                $("page_background_regist_filter").setStyles({'height':'100%'});
                $("page_background_regist").setStyles({'height':'100%'});
            }
		}
		
	};
	
window.addEvent('domready', myMooFlowPage.start);
window.onresize = resize;
var mf;
//test browser type
var user = navigator.userAgent;
var browser = {};
browser.opera = user.indexOf("Opera") > -1 && typeof window.opera == "object";
browser.ie = user.indexOf("MSIE") > -1 && !browser.opera;
browser.ff = user.indexOf("Firefox") > -1;
browser.chrome = user.indexOf("Chrome") > -1;
browser.safari = user.indexOf("Safari") > -1;
var ifWatchMovie = false;
var ifRegist = false;
var ifLogin = false;
var regist_email = false;
var regist_pass = false;
var login_email = false;
var login_pass = false;
var has_click_login_pass = false;
var has_click_regist_pass = false;
$j(document).mousemove(mouseMove);
$j(document).keydown(esc)

var titleHeight = 45;
var videoTitle;
var videoTitleLength;
var videoTitleLeft1;
var videoTitleLeft2;
var standardTitleLength = 51;
var playerCoverContentLeft;
var playerCoverContentTop;
var playerCoverContentRight;
var playerCoverContentBottom;
var playerCoverBottom;
var titleWordsHeight = 14;
var videoPlayLink;
var watchVideoStart;
var watchVideoEnd;
var watchVideoId;

function loadImages()
{
    var preload_img0 = new Image();
    preload_img0.src = "ico/remove_mouseon.png";
    var preload_img1 = new Image();
    preload_img1.src = "ico/remove_click.png";
    var preload_img2 = new Image();
    preload_img2.src = "ico/remove.png";
    var preload_img3 = new Image();
    preload_img3.src = "ico/title_bg.png";
    var preload_img4 = new Image();
    preload_img4.src = "ico/share/renren.png";
    var preload_img5 = new Image();
    preload_img5.src = "ico/go_mouseon.png";
    var preload_img6 = new Image();
    preload_img6.src = "ico/go.png";
    var preload_img7 = new Image();
    preload_img7.src = "ico/go_click.png";
    var preload_img8 = new Image();
    preload_img8.src = "ico/title_bg.png";
    var preload_img9 = new Image();
    preload_img9.src = "ico/video_edge.png";
    var preload_img10 = new Image();
    preload_img10.src = "ico/button.png";
    var preload_img11 = new Image();
    preload_img11.src = "ico/button_mouseon.png";
    var preload_img12 = new Image();
    preload_img12.src = "ico/button_click.png";
    var preload_img13 = new Image();
    preload_img13.src = "ico/reg_button_mouseon.png";
    var preload_img14 = new Image();
    preload_img14.src = "ico/reg_button_click.png";
    var preload_img15 = new Image();
    preload_img15.src = "ico/login_reg/regist_bg.png";
    var preload_img16 = new Image();
    preload_img16.src = "ico/login_reg/email_activation_bg.png";
    var preload_img17 = new Image();
    preload_img17.src = "ico/login_reg/login_close_normal.png";
    var preload_img18 = new Image();
    preload_img18.src = "ico/login_reg/login_close_mouseon.png";
    var preload_img19 = new Image();
    preload_img19.src = "ico/login_reg/login_close_click.png";
    var preload_img20 = new Image();
    preload_img20.src = "ico/login_reg/button_mouseon.png";
    var preload_img21 = new Image();
    preload_img21.src = "ico/login_reg/button_normal.png";
    var preload_img22 = new Image();
    preload_img22.src = "ico/login_reg/button_click.png";
    var preload_img23 = new Image();
    preload_img23.src = "ico/login_reg/mail_mouseon.png";
    var preload_img24 = new Image();
    preload_img24.src = "ico/login_reg/mail_normal.png";
    var preload_img25 = new Image();
    preload_img25.src = "ico/login_reg/mail_click.png";
    var preload_img26 = new Image();
    preload_img26.src = "ico/login_reg/input.png";
    var preload_img27 = new Image();
    preload_img27.src = "ico/logo4.png";
    var preload_img28 = new Image();
    preload_img28.src = "ico/tutorial.png";
}

function esc(e)
{
	if (e.keyCode == 27)
	{
		if (ifWatchMovie)
		{
			clearmovie();
		}
		if (ifRegist && $('registPanel'))
		{
			clearregist($('regist_close'));	
		}
		if (ifLogin && $('loginPanel'))
		{
			clearLogin($('login_close'));
		}
        if ($('emailActivate'))
        {
            $('emailActivate').destroy();
	        $("page_background_regist_filter").setStyle("visibility", "hidden");
	        $("page_background_regist").setStyle("visibility", "hidden");
        }
		if ($('regist_close'))
		{
			clearregist($('regist_close'));	
		}
	}
}

function clearmovie()
{
	ifWatchMovie = false;
	if (browser.ie)
	{
        $j('#videoplayer').remove();
	}
	else
	{
		$('videoplayer').destroy();
	}
    if ($j('#renren_share'))
    {
        $j('#renren_share').remove();
        watchVideoEnd = new Date();
        var s = (watchVideoEnd.getTime() - watchVideoStart.getTime()) / 1000;
        track_watch_video(watchVideoId, s);
    }
    if ($j('#weibo_share'))
    {
        $j('#weibo_share').remove();
    }
    if ($j('#tencentweibo_share'))
    {
        $j('#tencentweibo_share').remove();
    }
    if ($j('#qqkongjian_share'))
    {
        $j('#qqkongjian_share').remove();
    }
	$('playwindow_scanlist_center').setStyle('z-index', -1);
	$('playwindow_background_center').tween('opacity', 0);
	$('playwindow_background_center').setStyle('z-index', 0);
	$('removemovie').setStyle('visibility', 'hidden');
    if (this.player.cover)
    {
	    this.player.cover.destroy();
    }
    if (this.player)
    {
	    this.player.destroy();
    }
}

function track_watch_video(videoid, period)
{
	var xmlhttp;
	if (window.XMLHttpRequest)
  	{// code for IE7+, Firefox, Chrome, Opera, Safari
  		xmlhttp=new XMLHttpRequest();
  	}
	else
  	{// code for IE6, IE5
  		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  	}
	/*xmlhttp.onreadystatechange=function()
  	{
  		if (xmlhttp.readyState==4 && xmlhttp.status==200)
    	{
            alert(xmlhttp.responseText);
    	}
  	}*/
	xmlhttp.open("POST","track_anonymous_user_watch_video.php",true);
	xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
	xmlhttp.send("videoid=" + videoid + "&period=" + period);
}
function ClickToRemoveMovie()
{
	clearmovie();
}

function buttonover(o)
{
	if (browser.ie)
		o.style.backgroundImage = "url('ico/button_mouseon.png')";
	else
		o.setStyle('background-image', 'url(ico/button_mouseon.png)');
}
function buttondown(o)
{
	if (browser.ie)
		o.style.backgroundImage = "url('ico/button_click.png')";
	else
		o.setStyle('background-image', 'url(ico/button_click.png)');
}
function buttonup(o)
{
	if (browser.ie)
		o.style.backgroundImage = "url('ico/button_mouseon.png')";
	else
		o.setStyle('background-image', 'url(ico/button_mouseon.png)');
}
function buttonout(o)
{
	if (browser.ie)
		o.style.backgroundImage = "";
	else
		o.setStyle('background-image', '');
}
function loginover(o)
{
	if (browser.ie)
    {
		o.style.backgroundImage = "url('ico/reg_button_mouseon.png')";
    }
	else
		o.setStyle('background-image', 'url(ico/reg_button_mouseon.png)');	
    //$j('#loginword').css('color', 'rgb(242, 242, 242)');
}

function loginup(o)
{
	if (browser.ie)
		o.style.backgroundImage = "url('ico/reg_button_mouseon.png')";
	else
		o.setStyle('background-image', 'url(ico/reg_button_mouseon.png)');	
}

function logindown(o)
{
	if (browser.ie)
		o.style.backgroundImage = "url('ico/reg_button_click.png')";
	else
		o.setStyle('background-image', 'url(ico/reg_button_click.png)');	
}

function loginout(o)
{
	if (browser.ie)
		o.style.backgroundImage = "";
	else
		o.setStyle('background-image', '');	
    //$j('#loginword').css('color', '#000');
}

function registover(o)
{
	if (browser.ie)
    {
		o.style.backgroundImage = "url('ico/reg_button_mouseon.png')";
    }
	else
		o.setStyle('background-image', 'url(ico/reg_button_mouseon.png)');	
    //$j('#registword').css('color', 'rgb(242, 242, 242)');
}

function registup(o)
{
	if (browser.ie)
		o.style.backgroundImage = "url('ico/reg_button_mouseon.png')";
	else
		o.setStyle('background-image', 'url(ico/reg_button_mouseon.png)');	
}

function registdown(o)
{
	if (browser.ie)
		o.style.backgroundImage = "url('ico/reg_button_click.png')";
	else
		o.setStyle('background-image', 'url(ico/reg_button_click.png)');	
}

function registout(o)
{
	if (browser.ie)
		o.style.backgroundImage = "";
	else
		o.setStyle('background-image', '');	
    //$j('#registword').css('color', '#000');
}

function system_rec_click()
{
    if (ifWatchMovie)
    {
        clearmovie();
    }
    $j('#scanlist').empty();
    var scanlist_content = new Element('div', {id:"scanlist_content", 'class':"unselectable"}).inject($('scanlist'), 'top');
    mf = new MooFlow($('scanlist_content'), {
	    startIndex: 0,
	    useSlider: true,
	    useAutoPlay: false,
	    useCaption: true,
	    useResize: false,
	    useMouseWheel: true,
	    useKeyInput: true
    });
    mf.loadData("getSystemRecInfo.php");
}

function favclick()
{
	$("page_background_regist_filter").setStyle("visibility", "visible");
	$('page_background_regist_filter').set('opacity', 0.8);
	$("page_background_regist").setStyle("visibility", "visible");
	this.emailActivate = new Element('div', {id:"emailActivate"}).addClass('emailActivateClass').inject($("page_background_regist"));
	this.emailActivate.first = new Element('div', {id:"registPanel_first"}).addClass('registPanel_firstClass').inject(this.emailActivate);
	this.emailActivate.first.closebutton_background = new Element('div', {id:"registPanel_first_closebutton_background"}).addClass('registPanel_first_closebutton_backgroundClass').inject(this.emailActivate.first);
	this.emailActivate.first.closebutton_background.innerHTML = "<img src='ico/login_reg/login_close_normal.png' id='regist_close' onclick='clearregist(this)' onmouseover='closeregistMouseOver(this)' onmouseout='closeregistMouseOut(this)' onmousedown='closeregistMouseDown(this)' onmouseup='closeregistMouseUp(this)' />";
	this.emailActivate.second = new Element('div', {id:'emailActivate_second'}).addClass('needUser_secondClass').inject($(this.emailActivate));
	this.emailActivate.second.innerHTML = "<img style='position:relative; top:-30px' src='ico/logo4.png' unselectable='on' class='unselectable'/>";
	this.emailActivate.third = new Element('div', {id:'emailActivate_third'}).addClass('needUser_thirdClass').inject($(this.emailActivate));
	this.emailActivate.third.innerHTML = "<span style='color:#999'>您还未登陆!</br>";
    this.emailActivate.forth = new Element('div', {id:'emailActivate_forth'}).addClass('emailActivate_login_regist').inject($(this.emailActivate));
    this.emailActivate.forth.innerHTML = " <div id='emailActivate_login' style='cursor:pointer;' onmouseover='loginover(this)' onmouseout='loginout(this)' onclick='loginclick()' onmousedown='logindown(this)' onmouseup='loginup(this)'><span class='loginclass'>登录</span></div> <div id='emailActivate_regist' style='cursor:pointer;' onmouseover='registover(this)' onmouseout='registout(this)' onclick='registclick()' onmousedown='registdown(this)' onmouseup='registup(this)'><span class='loginclass'>注册</span></div>";
}

function registclick()
{
	if (ifWatchMovie)
	{
		clearmovie();
	}
    if ($('emailActivate'))
    {
        $('emailActivate').destroy();
    }
	regist_email = false;
	regist_pass = false;
	ifRegist = true;
	$("page_background_regist_filter").setStyle("visibility", "visible");
	$('page_background_regist_filter').set('opacity', 0.8);
	$("page_background_regist").setStyle("visibility", "visible");
	this.registPanel = new Element('div', {id:"registPanel"}).addClass('registPanelClass').inject($("page_background_regist"));
	this.registPanel.first = new Element('div', {id:"registPanel_first"}).addClass('registPanel_firstClass').inject(this.registPanel);
	this.registPanel.first.closebutton_background = new Element('div', {id:"registPanel_first_closebutton_background"}).addClass('registPanel_first_closebutton_backgroundClass').inject(this.registPanel.first);
	this.registPanel.first.closebutton_background.innerHTML = "<img src='ico/login_reg/login_close_normal.png' id='regist_close' onclick='clearregist(this)' onmouseover='closeregistMouseOver(this)' onmouseout='closeregistMouseOut(this)' onmousedown='closeregistMouseDown(this)' onmouseup='closeregistMouseUp(this)' />";
	this.registPanel.second = new Element('div', {id:"registPanel_second"}).addClass('registPanel_234Class').inject(this.registPanel);
	this.registPanel.second.background = new Element('div', {id:"registPanel_second_background"}).addClass('registPanel_23_backgroundClass').inject(this.registPanel.second);
	this.registPanel.second.message = new Element('div', {id:'registPanel_second_message'}).addClass('registPanel_23_messageClass').inject(this.registPanel.second);
    if (browser.ie)
    {
	    this.registPanel.second.right = new Element('div').addClass('registPanel_23_rightClass').inject(this.registPanel.second.background);
	    this.registPanel.second.right.innerHTML = "<input spellcheck='false' id='regist_email' class='emailIEInput' type='text' value='请输入邮箱' onclick='textRegistClick(this)' onblur='textRegistBlur(this)' onfocus='textRegistClick(this)' onkeypress='textRegistKeyPress(event, this)' />";
    }
    else
    {
	    this.registPanel.second.right = new Element('div').addClass('registPanel_23_rightClass').inject(this.registPanel.second.background);
	    this.registPanel.second.right.innerHTML = "<input spellcheck='false' id='regist_email' class='emailInput' type='text' value='请输入邮箱' onclick='textRegistClick(this)' onblur='textRegistBlur(this)' onfocus='textRegistClick(this)' onkeypress='textRegistKeyPress(event, this)' />";
    }
	this.registPanel.third = new Element('div', {id:"registPanel_third"}).addClass('registPanel_234Class').inject(this.registPanel);
	this.registPanel.third.background = new Element('div', {id:"registPanel_third_background"}).addClass('registPanel_23_backgroundClass').inject(this.registPanel.third);
    if (browser.ie)
    {
	    this.registPanel.third.right = new Element('div', {id:'registPanel_third_right'}).addClass('registPanel_23_rightClass').inject(this.registPanel.third.background);
	    this.registPanel.third.right.innerHTML = "<input spellcheck='false' id='regist_pass' class='emailIEInput' type='text' value='请输入密码' onclick='passRegistClick(this)' onblur='passRegistBlur(this)' onfocus='passRegistClick(this)' onkeypress='passRegistKeyPress(event, this)' />";
    }
    else
    {
	    this.registPanel.third.right = new Element('div').addClass('registPanel_23_rightClass').inject(this.registPanel.third.background);
	    this.registPanel.third.right.innerHTML = "<input spellcheck='false' id='regist_pass' class='emailInput' type='text' value='请输入密码' onclick='passRegistClick(this)' onblur='passRegistBlur(this)' onfocus='passRegistClick(this)' onkeypress='passRegistKeyPress(event, this)' />";
    }
	this.registPanel.third.message = new Element('div', {id:'registPanel_third_message'}).addClass('registPanel_23_messageClass').inject(this.registPanel.third);
	this.registPanel.forth = new Element('div', {id:"registPanel_forth"}).addClass('registPanel_234Class').inject(this.registPanel);
	this.registPanel.forth.innerHTML = "<div id='registPanel_forth_button' class='registPanel_forth_buttonClass' onmouseover='registButtonMouseOver(this)' onmouseout='registButtonMouseOut(this)' onmousedown='registButtonMouseDown(this)' onclick='registButtonClick(this)' onmouseup='registButtonMouseUp(this)'><div style='position:relative; top:10px'><span class='registButtonClass'>注册</span></div></div>";
	this.registPanel.fifth = new Element('div', {id:"registPanel_fifth"}).addClass('registPanel_fifthClass').inject(this.registPanel);
}

function loginclick()
{
	if (ifWatchMovie)
	{
		clearmovie();
	}
    if ($('emailActivate'))
    {
        $('emailActivate').destroy();
    }
	login_email = false;
	login_pass = false;
    has_click_login_pass = false;
    has_click_regist_pass = false;
	ifLogin = true;
	$("page_background_regist_filter").setStyle("visibility", "visible");
	$('page_background_regist_filter').set('opacity', 0.8);
	$("page_background_regist").setStyle("visibility", "visible");
	this.loginPanel = new Element('div', {id:"loginPanel"}).addClass('registPanelClass').inject($("page_background_regist"));
	this.loginPanel.form = new Element('form', {id:"loginForm"}).inject(this.loginPanel);
	this.loginPanel.form.set('action', 'index.php');
	this.loginPanel.form.set('method', 'post');
	this.loginPanel.form.set('onsubmit', 'return loginButtonClick()');
	this.loginPanel.first = new Element('div', {id:"loginPanel_first"}).addClass('registPanel_firstClass').inject(this.loginPanel.form);
	this.loginPanel.first.closebutton_background = new Element('div', {id:"loginPanel_first_closebutton_background"}).addClass('registPanel_first_closebutton_backgroundClass').inject(this.loginPanel.first);
	this.loginPanel.first.closebutton_background.innerHTML = "<img src='ico/login_reg/login_close_normal.png' id='login_close' onclick='clearLogin(this)' onmouseover='closeregistMouseOver(this)' onmouseout='closeregistMouseOut(this)' onmousedown='closeregistMouseDown(this)' onmouseup='closeregistMouseUp(this)' />";
	this.loginPanel.second = new Element('div', {id:"loginPanel_second"}).addClass('registPanel_234Class').inject(this.loginPanel.form);
	this.loginPanel.second.background = new Element('div', {id:"loginPanel_second_background"}).addClass('registPanel_23_backgroundClass').inject(this.loginPanel.second);
    if (browser.ie)
    {
	    this.loginPanel.second.right = new Element('div').addClass('registPanel_23_rightClass').inject(this.loginPanel.second.background);
	    this.loginPanel.second.right.innerHTML = "<input spellcheck='false' class='emailIEInput' id='login_email' name='username' type='text' value='请输入邮箱' onclick='textLoginClick(this)' onblur='textLoginBlur(this)' onfocus='textLoginClick(this)' onkeypress='textLoginKeyPress(event, this)' />";
    }
    else
    {
	    this.loginPanel.second.right = new Element('div').addClass('registPanel_23_rightClass').inject(this.loginPanel.second.background);
	    this.loginPanel.second.right.innerHTML = "<input spellcheck='false' id='login_email' class='emailInput' name='username' type='text' value='请输入邮箱' onclick='textLoginClick(this)' onblur='textLoginBlur(this)' onfocus='textLoginClick(this)' onkeypress='textLoginKeyPress(event, this)' />";
    }
	this.loginPanel.second.message = new Element('div', {id:'loginPanel_second_message'}).addClass('registPanel_23_messageClass').inject(this.loginPanel.second);
	this.loginPanel.third = new Element('div', {id:"loginPanel_third"}).addClass('registPanel_234Class').inject(this.loginPanel.form);
	this.loginPanel.third.background = new Element('div', {id:"loginPanel_third_background"}).addClass('registPanel_23_backgroundClass').inject(this.loginPanel.third);
    if (browser.ie)
    {
	    this.loginPanel.third.right = new Element('div', {id:'loginPanel_third_right'}).addClass('registPanel_23_rightClass').inject(this.loginPanel.third.background);
	    this.loginPanel.third.right.innerHTML = "<input spellcheck='false' id='login_pass' class='emailIEInput' name='password' type='text' value='请输入密码' onclick='passLoginClick(this)' onblur='passLoginBlur(this)' onfocus='passLoginClick(this)' onkeypress='passLoginKeyPress(event, this)' />";
    }
    else
    {
	    this.loginPanel.third.right = new Element('div').addClass('registPanel_23_rightClass').inject(this.loginPanel.third.background);
	    this.loginPanel.third.right.innerHTML = "<input spellcheck='false' id='login_pass' class='emailInput' name='password' type='text' value='请输入密码' onclick='passLoginClick(this)' onblur='passLoginBlur(this)' onfocus='passLoginClick(this)' onkeypress='passLoginKeyPress(event, this)' />";
    }
	this.loginPanel.third.message = new Element('div', {id:'loginPanel_third_message'}).addClass('registPanel_23_messageClass').inject(this.loginPanel.third);
	this.loginPanel.forth = new Element('div', {id:"loginPanel_forth"}).addClass('loginPanel_forthClass').inject(this.loginPanel.form);
    if (browser.ie)
    {
	    this.loginPanel.forth.stay = new Element('span').addClass('loginPanel_forth_stayIEClass').inject(this.loginPanel.forth);
	    this.loginPanel.forth.stay.innerHTML = "<input type='checkbox' id='stay' name='stay' value='stay' />";
	    this.loginPanel.forth.stay.message = new Element('div').addClass('loginPanel_forth_stay_messageIEClass').inject(this.loginPanel.forth.stay);
	    this.loginPanel.forth.stay.message.innerHTML = " <div class='persistlogin' style='cursor:pointer;' onclick='stayOnclick()'>持续登录</div>";
	    this.loginPanel.forth.forgetpass = new Element('div').addClass('loginPanel_forth_forgetpassIEClass').inject(this.loginPanel.forth);
	    this.loginPanel.forth.forgetpass.innerHTML = "<div style='cursor:pointer' onclick='forgetPass(); return false;'><div class='persistlogin'>忘记密码？</div></div>";
    }
    else
    {
	    this.loginPanel.forth.stay = new Element('span').addClass('loginPanel_forth_stayClass').inject(this.loginPanel.forth);
	    this.loginPanel.forth.stay.innerHTML = "<input type='checkbox' id='stay' name='stay' value='stay' />";
	    this.loginPanel.forth.stay.message = new Element('span').addClass('loginPanel_forth_stay_messageClass').inject(this.loginPanel.forth.stay);
	    this.loginPanel.forth.stay.message.innerHTML = " <span style='cursor:pointer;' class='persistlogin' onclick='stayOnclick()'>持续登录</span>";
	    this.loginPanel.forth.forgetpass = new Element('span').addClass('loginPanel_forth_forgetpassClass').inject(this.loginPanel.forth);
	    this.loginPanel.forth.forgetpass.innerHTML = "<span style='cursor:pointer' onclick='forgetPass(); return false;'><span class='persistlogin'>忘记密码？</span></span>";
    }
	this.loginPanel.fifth = new Element('div', {id:"loginPanel_fifth"}).addClass('loginPanel_fifthClass').inject(this.loginPanel.form);
	this.loginPanel.fifth.innerHTML = "<input type='submit' id='loginPanel_fifth_button' class='loginPanel_fifth_buttonClass registButtonClass' onmouseover='loginButtonMouseOver(this)' onmouseout='loginButtonMouseOut(this)' onmousedown='loginButtonMouseDown(this)' onmouseup='loginButtonMouseUp(this)' value='登录'>";
}

function stayOnclick()
{
	if ($('stay').checked)
	{
		$('stay').checked = false;
	}
	else
	{
		$('stay').checked = true;	
	}
}

function logoutclick()
{
	window.location.href="logout.php";	
}

function clearLogin(o)
{
	ifLogin = false;
	o.src = 'ico/login_reg/login_close_click.png';
	$("page_background_regist_filter").setStyle("visibility", "hidden");
	$("page_background_regist").setStyle("visibility", "hidden");
	$("loginPanel").destroy();
}

function textRegistClick(o)
{
	o.value = "";
    if (browser.ie)
    {
        o.style.color = '#000';
    }
    else
    {
	    o.setStyle('color', '#000');
    }
	$('registPanel_second_message').innerHTML = "<span class='messageclass' style='color:#999'>请输入正确的邮箱地址</span>";
}

function textLoginClick(o)
{
	o.value = "";
    if (browser.ie)
    {
        o.style.color = '#000';
    }
    else
    {
	    o.setStyle('color', '#000');
    }
}

function textRegistBlur(o)
{
	var re = /^[ a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}[ ]*$/;
	if (re.test(o.value))
	{
		testRegistEmailValid(normalizeEmail(o.value));
	}
    else if (o.value == "")
    {
		regist_email = false;
		$('registPanel_second_message').innerHTML = "<span class='messageclass' style='color:#F00'>请输入邮箱</span>";
    }
	else
	{
		regist_email = false;
		$('registPanel_second_message').innerHTML = "<span class='messageclass' style='color:#F00'>邮箱地址格式错误</span>";
	}
}

function textLoginBlur(o)
{
	if (o.value == "")
	{
		login_email = false;
		$('loginPanel_second_message').innerHTML = "<span class='messageclass' style='color:#F00'>请输入邮箱</span>";
        return false;
	}
	else
	{
		var re = /^[ a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}[ ]*$/;
		if (re.test(o.value))
		{
			$('loginPanel_second_message').innerHTML = "<span class='messageclass' color:#F00'></span>";
			login_email = true;	
            o.value = normalizeEmail(o.value);
            return true;
		}
		else
		{
			login_email = false;
			$('loginPanel_second_message').innerHTML = "<span class='messageclass' style='color:#F00'>邮箱地址格式错误</span>";
            return false;
		}
	}
}

function textRegistKeyPress(e, o)
{
	if (e.keyCode == 13)
	{
		textRegistBlur(o);
		if (regist_email && regist_pass)
		{
			registButtonClick($('registPanel_forth_button'));	
		}
		if (!regist_pass)
		{
			if ($('regist_pass').get('type') == 'text')
			{
				$('registPanel_third_message').innerHTML = "<span class='messageclass' style='color:#F00'>请输入密码</span>";
			}
		}
	}	
}

function textLoginKeyPress(e, o)
{
	if (e.keyCode == 13)
	{
		textLoginBlur(o);
		if (login_email && login_pass)
		{
			$('loginForm').submit();	
		}
		if (!login_pass)
		{
			if ($('login_pass').get('type') == 'text')
			{
				$('loginPanel_third_message').innerHTML = "<span class='messageclass' style='color:#F00'>请输入密码</span>";
			}
		}
	}
}

function testRegistEmailValid(email)
{
	var xmlhttp;
	if (window.XMLHttpRequest)
  	{// code for IE7+, Firefox, Chrome, Opera, Safari
  		xmlhttp=new XMLHttpRequest();
  	}
	else
  	{// code for IE6, IE5
  		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  	}
	xmlhttp.onreadystatechange=function()
  	{
  		if (xmlhttp.readyState==4 && xmlhttp.status==200)
    	{
            if ($('registPanel_second_message'))
            {
			    if (xmlhttp.responseText == "true")
			    {
				    $('registPanel_second_message').innerHTML = "<span class='messageclass' style='color:#090'>地址有效</span>";
				    regist_email = true;
			    }
			    else
			    {
				    $('registPanel_second_message').innerHTML = "<span class='messageclass' style='color:#F00'>该邮箱已被注册</span>";
				    regist_email = false;	
			    }
            }
    	}
  	}
	xmlhttp.open("POST","emailValidTest.php",true);
	xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
	xmlhttp.send("email=" + email);
}

function passRegistClick(o)
{
	o.value = "";
    if ($j('#regist_pass').attr('type') != 'password')
    {
        if (browser.ie)
        {
            if (!has_click_regist_pass)
            {
    	        $('registPanel_third_right').innerHTML = "<input id='regist_pass' type='password' value='密码' class='emailIEInput'  onclick='passRegistClick(this)' onblur='passRegistBlur(this)' onfocus='passRegistClick(this)' onkeypress='passRegistKeyPress(event, this)' />";
                $('regist_pass').setStyle('color', '#000');
                $('regist_pass').focus();
            }
        }
        else
        {
    	    o.setStyle('color', '#000');
    	    o.set('type', 'password');
            $j('#regist_pass').focus();
        }
    }
	$('registPanel_third_message').innerHTML = "<span class='messageclass' style='color:#999'>密码由6-20位半角字符（字母、数字、符号）组成</span>";
    has_click_regist_pass = true;
}

function passLoginClick(o)
{
	o.value = "";
    
    if ($j('#login_pass').attr('type') != 'password')
    {
        if (browser.ie)
        {
            if (!has_click_login_pass)
            {
    	        $('loginPanel_third_right').innerHTML = "<input id='login_pass' name='password' type='password' class='emailIEInput'  onclick='passLoginClick(this)' onblur='passLoginBlur(this)' onfocus='passLoginClick(this)' onkeypress='passLoginKeyPress(event, this)' />";
                $('login_pass').setStyle('color', '#000');
                $('login_pass').focus();
            }
        }
        else
        {
    	    o.setStyle('color', '#000');
    	    o.set('type', 'password');
            $j('#login_pass').focus();
        }
    }
    has_click_login_pass = true;
}

function passRegistBlur(o)
{
	if (o.value.length > 5 && o.value.length < 21 && o.value != "请输入密码")
	{
		regist_pass = true;
		$('registPanel_third_message').innerHTML = "<span class='messageclass' style='color:#090'>密码有效</span>";
	}
	else
	{
		regist_pass = false;
		$('registPanel_third_message').innerHTML = "<span class='messageclass' style='color:#F00'>密码长度应为6-20</span>";
	}
}

function passLoginBlur(o)
{
	if (o.value.length == 0 || o.value == '请输入密码')
	{
		login_pass = false;
		$('loginPanel_third_message').innerHTML = "<span class='messageclass' style='color:#F00'>请输入密码</span>";
	}
	else if (o.value.length > 5 && o.value.length < 21)
	{
		$('loginPanel_third_message').innerHTML = "<span class='messageclass' style='color:#F00'></span>";
		login_pass = true;
	}
	else
	{
		login_pass = false;
		$('loginPanel_third_message').innerHTML = "<span class='messageclass' style='color:#F00'>密码长度应为6-20</span>";
	}
}

function passRegistKeyPress(e, o)
{
	if (e.keyCode == 13)
	{
		passRegistBlur(o);
		if (regist_email && regist_pass)
		{
			registButtonClick($('registPanel_forth_button'));	
		}
		if (!regist_email)
		{
			if ($('regist_email').value && $('regsit_email').value == "请输入邮箱")
			{
				$('registPanel_second_message').innerHTML = "<span class='messageclass' style='color:#F00'>请输入邮箱</span>";
			}
		}
	}
}

function passLoginKeyPress(e, o)
{
	if (e.keyCode == 13)
	{
		passLoginBlur(o);
		if (login_email && login_pass)
		{
			$('loginForm').submit();	
		}
		if (!login_email)
		{
			if ($('login_email').value == "请输入邮箱")
			{
				$('loginPanel_second_message').innerHTML = "<span class='messageclass' style='color:#F00'>请输入注册邮箱</span>";
			}
		}
	}	
}

function registButtonClick(o)
{
    textRegistBlur($('regist_email'));
	passRegistBlur($('regist_pass'));
	if (regist_email && regist_pass)
	{
		var email = $('regist_email').value;
		var pass = $('regist_pass').value;
		var xmlhttp;
		if (window.XMLHttpRequest)
		{// code for IE7+, Firefox, Chrome, Opera, Safari
			xmlhttp=new XMLHttpRequest();
		}
		else
		{// code for IE6, IE5
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
		xmlhttp.onreadystatechange=function()
		{
			if (xmlhttp.readyState==4 && xmlhttp.status==200)
			{
				//alert(xmlhttp.responseText);
			}
		}
		xmlhttp.open("POST","regist.php",true);
		xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
		xmlhttp.send('email=' + email + '&password=' + pass);
		$('registPanel').destroy();
		this.emailActivate = new Element('div', {id:"emailActivate"}).addClass('emailActivateClass').inject($("page_background_regist"));
		this.emailActivate.first = new Element('div', {id:"registPanel_first"}).addClass('registPanel_firstClass').inject(this.emailActivate);
		this.emailActivate.first.closebutton_background = new Element('div', {id:"registPanel_first_closebutton_background"}).addClass('registPanel_first_closebutton_backgroundClass').inject(this.emailActivate.first);
		this.emailActivate.first.closebutton_background.innerHTML = "<img src='ico/login_reg/login_close_normal.png' id='regist_close' onclick='clearregist(this)' onmouseover='closeregistMouseOver(this)' onmouseout='closeregistMouseOut(this)' onmousedown='closeregistMouseDown(this)' onmouseup='closeregistMouseUp(this)' />";
		this.emailActivate.second = new Element('div', {id:'emailActivate_second'}).addClass('emailActivate_secondClass').inject($(this.emailActivate));
		this.emailActivate.second.innerHTML = "<span style='color:#999'>请登录<br/>" + email + "<br/>激活账户。成功激活后，<br/>您可以使用网站全部功能。<br/>感谢您的注册！</span>";
		this.emailActivate.third = new Element('div', {id:'emailActivate_third'}).addClass('emailActivate_thirdClass').inject($(this.emailActivate));
		this.emailActivate.third.innerHTML = "<div id='emailActivate_button' class='emailActivate_buttonClass' onmouseover='activateMouseOver(this)' onmouseout='activateMouseOut(this)' onmousedown='activateMouseDown(this)' onmouseUp='activateMouseUp(this)' onclick='activateClick(this, \"" + email + "\")' /><div style='position:relative; top:8px;'><span class='registButtonClass'>立即查看邮箱</span></div></div>";
	}
	else
	{
		textRegistBlur($('regist_email'));
		passRegistBlur($('regist_pass'));
	}
}

function loginButtonClick()
{
	if (login_email && login_pass)
	{
		return true;
	}
    textLoginBlur($('login_email'));
	passLoginBlur($('login_pass'));
	return false;
}

function activateMouseOver(o)
{
	if (browser.ie)
		o.style.backgroundImage = "url('ico/login_reg/mail_mouseon.png')";
	else
		o.setStyle('background-image', 'url(ico/login_reg/mail_mouseon.png)');
}

function activateMouseOut(o)
{
	if (browser.ie)
		o.style.backgroundImage = "url('ico/login_reg/mail_normal.png')";
	else
		o.setStyle('background-image', 'url(ico/login_reg/mail_normal.png)');
}

function activateMouseDown(o)
{
	if (browser.ie)
		o.style.backgroundImage = "url('ico/login_reg/mail_click.png')";
	else
		o.setStyle('background-image', 'url(ico/login_reg/mail_click.png)');
}

function activateMouseUp(o)
{
	if (browser.ie)
		o.style.backgroundImage = "url('ico/login_reg/mail_mouseon.png')";
	else
		o.setStyle('background-image', 'url(ico/login_reg/mail_mouseon.png)');
}

function activateClick(o, s)
{
	window.open(getTail(s));
	clearregist($('regist_close'));
}

function getTail(email)
{
	var start = email.indexOf('@') + 1;
	var map = new Object();
	map['gmail.com'] = "http://www.gmail.com";
	map['sina.com'] = "http://mail.sina.com.cn/";
	map['163.com'] = "http://mail.163.com";
	map['qq.com'] = "http://mail.qq.com";
	map['126.com'] = "http://mail.126.com";
	map['vip.sina.com'] = "http://vip.sina.com.cn/";
	map['sina.cn'] = "http://mail.sina.com.cn/";
	map['hotmail.com'] = "http://hotmail.com";
	map['sohu.com'] = "http://mail.sohu.com/";
	map['yahoo.com'] = "http://mail.yahoo.com/";
	map['139.com'] = "http://mail.10086.cn/";
	map['wo.com.cn'] = "http://mail.wo.com.cn/";
	map['189.cn'] = "http://webmail8.189.cn/webmail/";
	email = email.substring(start);
	if (map[email])
	{
		email = map[email];
	}
	else
	{
		email = "http://www." + email;	
	}
	return email;	
}

function forgetPass()
{
    $('loginPanel').destroy();
    regist_email = false;
    this.emailActivate = new Element('div', {id:"emailActivate"}).addClass('emailActivateClass').inject($("page_background_regist"));
    this.emailActivate.first = new Element('div', {id:"registPanel_first"}).addClass('registPanel_firstClass').inject(this.emailActivate);
    this.emailActivate.first.closebutton_background = new Element('div', {id:"registPanel_first_closebutton_background"}).addClass('registPanel_first_closebutton_backgroundClass').inject(this.emailActivate.first);
    this.emailActivate.first.closebutton_background.innerHTML = "<img src='ico/login_reg/login_close_normal.png' id='regist_close' onclick='clearregist(this)' onmouseover='closeregistMouseOver(this)' onmouseout='closeregistMouseOut(this)' onmousedown='closeregistMouseDown(this)' onmouseup='closeregistMouseUp(this)' />";
    this.emailActivate.logo = new Element('div').addClass('changePass_logoClass').inject($(this.emailActivate));
    this.emailActivate.logo.innerHTML = "<img src='ico/logo4.png' />";
    this.emailActivate.third = new Element('div', {id:'emailActivate_third'}).addClass('changePass_thirdClass').inject($(this.emailActivate));
    this.emailActivate.third.center = new Element('div', {id:'changePass_input'}).addClass('changePass_input').inject(this.emailActivate.third);
    if (browser.ie)
    {
	    this.emailActivate.third.center.innerHTML = "<input spellcheck='false' id='changePass_email' class='emailIEInput' type='text' value='请输入邮箱账号' onclick='changePassInputClick(this)' onblur='changePassInputBlur(this)' onkeypress='changePassInputKeyPress(event, this)' />";
    }
    else
    {
	    this.emailActivate.third.center.innerHTML = "<input spellcheck='false' id='changePass_email' class='emailInput' type='text' value='请输入邮箱账号' onclick='changePassInputClick(this)' onblur='changePassInputBlur(this)' onkeypress='changePassInputKeyPress(event, this)' />";
    }
    this.emailActivate.third.message = new Element('div', {id:'changePass_message'}).inject(this.emailActivate.third);
	this.emailActivate.forth = new Element('div', {id:"changePass_forth"}).inject(this.emailActivate);
	this.emailActivate.forth.innerHTML = "<div id='changePassConfirm' class='changePassConfirmClass' onmouseover='loginButtonMouseOver(this)' onmouseout='loginButtonMouseOut(this)' onmousedown='loginButtonMouseDown(this)' onmouseup='loginButtonMouseUp(this)' onclick='changePassConfirmClick()'><div style='position:relative; top:10px'>确定</div></div>";
}

function changePassInputKeyPress(e, o)
{
	if (e.keyCode == 13)
	{
        changePassConfirmClick();
	}	
}

function changePassConfirmClick()
{
    changePassInputBlur($('changePass_email'));
    if (regist_email)
    {
        changePass($('changePass_email').value);
    }
}

function changePassInputClick(o)
{
	o.value = "";
    regist_email = false;
    if (browser.ie)
    {
        o.style.color = '#000';
    }
    else
    {
	    o.setStyle('color', '#000');
    }
}

function testChangePassEmailValid(email)
{
	var xmlhttp;
	if (window.XMLHttpRequest)
  	{// code for IE7+, Firefox, Chrome, Opera, Safari
  		xmlhttp=new XMLHttpRequest();
  	}
	else
  	{// code for IE6, IE5
  		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  	}
	xmlhttp.onreadystatechange=function()
  	{
  		if (xmlhttp.readyState==4 && xmlhttp.status==200)
    	{
            if ($('changePass_message'))
            {
			    if (xmlhttp.responseText == "true")
			    {
				    $('changePass_message').innerHTML = "<span class='messageclass' style='color:#F00'>不存在该邮箱账号</span>";
				    regist_email = false;
			    }
			    else
			    {
				    $('changePass_message').innerHTML = "";
				    regist_email = true;	
			    }
            }
    	}
  	}
	xmlhttp.open("POST","emailValidTest.php",true);
	xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
	xmlhttp.send("email=" + email);
}

function changePassInputBlur(o)
{
	var re = /^[ a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}[ ]*$/;
    if (o.value == "")
    {
        $('changePass_message').innerHTML = "<span class='messageclass' style='color:#F00'>账号不能为空</span>";
        regist_email = false;
        return false;
    }
	if (re.test(o.value))
	{
        //testChangePassEmailValid(o.value);
        $('changePass_message').innerHTML = "";
        regist_email = true;
        return true;
	}
    else
    {
        $('changePass_message').innerHTML = "<span class='messageclass' style='color:#F00'>邮箱账号格式错误</span>";
        regist_email = false;
        return false;
    }
}

function changePass(email)
{
    var result = normalizeEmail(email);
	var xmlhttp;
	if (window.XMLHttpRequest)
  	{// code for IE7+, Firefox, Chrome, Opera, Safari
  		xmlhttp=new XMLHttpRequest();
  	}
	else
  	{// code for IE6, IE5
  		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  	}
	/*xmlhttp.onreadystatechange=function()
  	{
  		if (xmlhttp.readyState==4 && xmlhttp.status==200)
    	{
            if (xmlhttp.responseText == 'NOUSER')
            {
        		$('emailActivate').destroy();
        		this.emailActivate = new Element('div', {id:"emailActivate"}).addClass('emailActivateClass').inject($("page_background_regist"));
        		this.emailActivate.first = new Element('div', {id:"registPanel_first"}).addClass('registPanel_firstClass').inject(this.emailActivate);
        		this.emailActivate.first.closebutton_background = new Element('div', {id:"registPanel_first_closebutton_background"}).addClass('registPanel_first_closebutton_backgroundClass').inject(this.emailActivate.first);
        		this.emailActivate.first.closebutton_background.innerHTML = "<img src='ico/login_reg/login_close_normal.png' id='regist_close' onclick='clearregist(this)' onmouseover='closeregistMouseOver(this)' onmouseout='closeregistMouseOut(this)' onmousedown='closeregistMouseDown(this)' onmouseup='closeregistMouseUp(this)' />";
        		this.emailActivate.second = new Element('div', {id:'emailActivate_second'}).addClass('emailActivate_secondClass').inject($(this.emailActivate));
        		this.emailActivate.second.innerHTML = "<span style='color:#999'>没有该用户!</span>";
            }
            else
            {
            }
    	}
  	}*/
	xmlhttp.open("POST","forgetPassword.php",true);
	xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
	xmlhttp.send("email=" + result);
	$('emailActivate').destroy();
	this.emailActivate = new Element('div', {id:"emailActivate"}).addClass('emailActivateClass').inject($("page_background_regist"));
	this.emailActivate.first = new Element('div', {id:"registPanel_first"}).addClass('registPanel_firstClass').inject(this.emailActivate);
	this.emailActivate.first.closebutton_background = new Element('div', {id:"registPanel_first_closebutton_background"}).addClass('registPanel_first_closebutton_backgroundClass').inject(this.emailActivate.first);
	this.emailActivate.first.closebutton_background.innerHTML = "<img src='ico/login_reg/login_close_normal.png' id='regist_close' onclick='clearregist(this)' onmouseover='closeregistMouseOver(this)' onmouseout='closeregistMouseOut(this)' onmousedown='closeregistMouseDown(this)' onmouseup='closeregistMouseUp(this)' />";
	this.emailActivate.second = new Element('div', {id:'emailActivate_second'}).addClass('emailActivate_secondClass').inject($(this.emailActivate));
	this.emailActivate.second.innerHTML = "<span style='color:#999'>请登录<br/>" + result + "<br/>设置新密码!</span>";
	this.emailActivate.third = new Element('div', {id:'emailActivate_third'}).addClass('emailActivate_thirdClass').inject($(this.emailActivate));
	this.emailActivate.third.innerHTML = "<div id='emailActivate_button' class='emailActivate_buttonClass' onmouseover='activateMouseOver(this)' onmouseout='activateMouseOut(this)' onmousedown='activateMouseDown(this)' onmouseUp='activateMouseUp(this)' onclick='activateClick(this, \"" + result + "\")' /><div style='position:relative; top:8px;'><span class='registButtonClass'>立即查看邮箱</span></div></div>";
}

function RemoveMovieMouseOver(o)
{
	o.src = "ico/remove_mouseon.png";
}

function RemoveMovieMouseDown(o)
{
	o.src = "ico/remove_click.png";
}

function RemoveMovieMouseUp(o)
{
	o.src = "ico/remove_mouseon.png";
}

function RemoveMovieMouseOut(o)
{
	o.src = "ico/remove.png";
}

function watchmovie(href, title, playlink)
{
	ifWatchMovie = true;
    videoTitle = title;
    videoPlayLink = playlink;
    watchVideoStart = new Date();
    watchVideoId = href;
	$('playwindow_background_center').setStyle('z-index', 99);
	$('playwindow_background_center').set('opacity', 0.8);
	$('playwindow_scanlist_center').setStyle('z-index', 100);
	$('playwindow_background').setStyle('z-index', 101);
	$('removemovie').setStyle('visibility', 'visible');
	this.player = new Element('div', {id:"player"}).inject($('playwindow_background'), 'top');
	this.player.setStyles({
		'width':'0px',
		'height':'498px',
		'background-color':'#FFF'
	});
	$("player").set('tween', {duration: 300});
	$("player").tween("width", 610);
    this.player.cover = new Element('div', {id:"player_cover"}).inject($('playwindow_background'), 'top');
    this.player.cover.setStyles({
        'width':'610px',
        'height':'100px',
        'left':'0px',
        'position':'absolute',
        'z-index':'150'
    });
    this.player.cover.content = new Element('div', {id:'player_cover_content'}).inject(this.player.cover, 'top');
    this.player.cover.content.setStyles({
        'width':'610px',
        'height':'0px',
        'left':'0px',
        'background-image':'url(ico/title_bg.png)',
        'background-repeat':'repeat',
        'overflow':'hidden',
        'text-align':'center'
    });

    this.player.cover.renren = new Element('img', {id:'renren_share'}).inject($('playwindow_background'), 'top');
	this.player.cover.renren.src = "ico/share/renren.png";
    this.player.cover.renren.setStyles({
        'position':'absolute',
        'top':'472px',
        'left':'150px',
        'cursor':'pointer',
        'opacity':'0',
        'z-index':'150'
    });
    $j('#renren_share').attr('title', '分享到人人');
    $j('#renren_share').click(renrenShare);

    this.player.cover.weibo = new Element('img', {id:'weibo_share'}).inject($('playwindow_background'), 'top');
	this.player.cover.weibo.src = "ico/share/weibo.gif";
    this.player.cover.weibo.setStyles({
        'position':'absolute',
        'top':'472px',
        'left':'180px',
        'cursor':'pointer',
        'opacity':'0',
        'z-index':'150'
    });
    $j('#weibo_share').attr('title', '分享到新浪微博');
    $j('#weibo_share').click(weiboShare);

    this.player.cover.tencentweibo = new Element('img', {id:'tencentweibo_share'}).inject($('playwindow_background'), 'top');
	this.player.cover.tencentweibo.src = "ico/share/tencentweibo.png";
    this.player.cover.tencentweibo.setStyles({
        'position':'absolute',
        'top':'472px',
        'left':'210px',
        'cursor':'pointer',
        'opacity':'0',
        'z-index':'150'
    });
    $j('#tencentweibo_share').attr('title', '分享到腾讯微博');
    $j('#tencentweibo_share').click(tencentweiboShare);

    this.player.cover.qqkongjian = new Element('img', {id:'qqkongjian_share'}).inject($('playwindow_background'), 'top');
	this.player.cover.qqkongjian.src = "ico/share/qqkongjian.png";
    this.player.cover.qqkongjian.setStyles({
        'position':'absolute',
        'top':'472px',
        'left':'240px',
        'cursor':'pointer',
        'opacity':'0',
        'z-index':'150'
    });
    $j('#qqkongjian_share').attr('title', '分享到qq空间');
    $j('#qqkongjian_share').click(qqkongjianShare);

	setTimeout(function() {embedswf(href)},250);
    $('player').addClass('unselectable');
    $('player_cover').addClass('unselectable');
    $('player_cover_content').addClass('unselectable');
    $j('#player').attr('unselectable', 'on');
    $j('#player_cover').attr('unselectable', 'on');
    $j('#player_cover_content').attr('unselectable', 'on');
    playerCoverContentLeft = $j('#player_cover_content').offset().left;
    playerCoverContentTop = $j('#player_cover_content').offset().top;
    playerCoverContentRight = playerCoverContentLeft + 610;
    playerCoverContentBottom = playerCoverContentTop + titleHeight;
    playerCoverBottom = playerCoverContentTop + 100;
    $j("#player_cover").mouseenter(playerCoverIn);
    $j("#player_cover").mouseleave(playerCoverOut);
}

function showShare()
{
    if ($("renren_share"))
    {
        $("renren_share").set('tween', {duration: 500});
        $("renren_share").tween("opacity", 1);
    }
    if ($("weibo_share"))
    {
        $("weibo_share").set('tween', {duration: 500});
        $("weibo_share").tween("opacity", 1);
    }
    if ($("tencentweibo_share"))
    {
        $("tencentweibo_share").set('tween', {duration: 500});
        $("tencentweibo_share").tween("opacity", 1);
    }
    if ($("qqkongjian_share"))
    {
        $("qqkongjian_share").set('tween', {duration: 500});
        $("qqkongjian_share").tween("opacity", 1);
    }
}

function renrenShare()
{
    window.open ('http://share.renren.com/share/buttonshare.do?link=' + videoPlayLink,'newwindow','height=500,width=500,top=0,left=0,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no, status=no');
}

function weiboShare()
{
    window.open('http://v.t.sina.com.cn/share/share.php?appkey=2684493555&url=' + videoPlayLink + '&title=' + videoTitle + '&ralateUid=1642904381&source=%E4%BC%98%E9%85%B7%E7%BD%91&sourceUrl=http%3A%2F%2Fwww.youku.com%2F&content=utf8', 'newwindow','height=500,width=500,top=0,left=0,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no, status=no');
}

function tencentweiboShare()
{
    window.open('http://share.v.t.qq.com/index.php?c=share&a=index&title=' + videoTitle + '&url=' + videoPlayLink + '&appkey=e7ad0b0199994bda85ecc0a44ce9915f&site=www.youku.com&assname=youku2010', 'newwindow','height=500,width=500,top=0,left=0,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no, status=no');
}

function qqkongjianShare()
{
    window.open('http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=' + videoPlayLink, 'newwindow','height=500,width=500,top=0,left=0,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no, status=no');
}

function playerCoverIn(e)
{
    $("player_cover_content").set('tween', {duration: 500});
    $("player_cover_content").tween("height", titleHeight);
    videoTitleLength = getTitleLength(videoTitle);
    $('player_cover_content').innerHTML = normalizeTitle(videoTitle, titleWordsHeight);
    if (videoTitleLength < 500)
    {
        $j('#title_div').css('visibility', 'visible');
    }
    else
    {
        $('player_cover_content').innerHTML = dynamicTitle(videoTitle, videoTitleLength, titleWordsHeight);
        setTimeout(function() { titleMove(); },500);
    }
}

function playerCoverOut(e)
{
    $("player_cover_content").set('tween', {duration: 500}); 
    $("player_cover_content").tween("height", 0);
    $j('#title_div').remove(); 
}

function embedswf(href)
{
	var flashvars = {playMovie:"true"};
	var params = {wmode:'opaque', quality:"high", allowScriptAccess:"always", allowfullscreen:"true"};
	var attributes = {id: "videoplayer"};
	swfobject.embedSWF("http://static.youku.com/v1.0.0097/qplayer.swf?&VideoIDS=" + href + "=&isAutoPlay=true&#=/v.swf", "player", "610", "498", "9.0.0", false, flashvars, params, attributes);
    setTimeout(function() { showShare(); },1000);
}

function mouseMove(e) {
    if (browser.ie)
    {
        var window_event = e;
        if (ifWatchMovie && window_event.pageX >= playerCoverContentLeft && window_event.pageX <= playerCoverContentRight && window_event.pageY >= playerCoverContentTop && window_event.pageY <= playerCoverBottom)
        {
            $("player_cover_content").set('tween', {duration: 100});
            $("player_cover_content").tween("height", titleHeight);
        }
    }
}

function resize()
{
    if ($('player_cover_content'))
    {
        playerCoverContentLeft = $j('#player_cover_content').offset().left;
        playerCoverContentTop = $j('#player_cover_content').offset().top;
        playerCoverContentRight = playerCoverContentLeft + 610;
        playerCoverContentBottom = playerCoverContentTop + titleHeight;
        playerCoverBottom = playerCoverContentTop + 100;
    }
    if (pageWidth() <= 1250)
    {
        $("page_background_regist_filter").setStyles({'width':'1250px'});
        $("page_background_regist").setStyles({'width':'1250px'});
    }
    else
    {
        $("page_background_regist_filter").setStyles({'width':'100%'});
        $("page_background_regist").setStyles({'width':'100%'});
    }
    if (pageHeight() <= 660)
    {
        $("page_background_regist_filter").setStyles({'height':'660px'});
        $("page_background_regist").setStyles({'height':'660px'});
    }
    else
    {
        $("page_background_regist_filter").setStyles({'height':'100%'});
        $("page_background_regist").setStyles({'height':'100%'});
    }
}

function titleMove()
{
    videoTitleLeft1 = Number($j('#title1').css('left'));
    videoTitleLeft2 = Number($j('#title2').css('left'));
    titleAni();
}

function titleAni()
{
    var time = videoTitleLength * 20;
    $("title1").set('tween', {duration: time, transition: Fx.Transitions.linear});
    $("title1").tween("left", '-' + videoTitleLength + 'px');
    $("title2").set('tween', {duration: (time * (1 + 200 / (200 + videoTitleLength))), transition: Fx.Transitions.linear});
    $("title2").tween("left", '0px');
}
function tutorialdown(o)
{
	if (browser.ie)
		o.style.backgroundImage = "url('ico/turorial_mouse_down.png')";
	else
		o.setStyle('background-image', 'url(ico/turorial_mouse_down.png)');	
}

function tutorialClick()
{
	$("page_background_regist_filter").setStyle("visibility", "visible");
	$('page_background_regist_filter').set('opacity', 0.8);
	$("page_background_regist").setStyle("visibility", "visible");
	new Element('div', {id:"tutorial_background"}).inject($("page_background_regist"));
    $('tutorial_background').innerHTML = '<img src="ico/tutorial.png" style="position:relative;width:1000px; height:563px;"/>';
	new Element('div', {id:"tutorial_close"}).inject($('tutorial_background'));
	$('tutorial_close').innerHTML = "<img src='ico/login_reg/login_close_normal.png' id='regist_close' onclick='clearregist(this)' onmouseover='closeregistMouseOver(this)' onmouseout='closeregistMouseOut(this)' onmousedown='closeregistMouseDown(this)' onmouseup='closeregistMouseUp(this)' />";
}
function logoutover(o)
{
	if (browser.ie)
		o.style.backgroundImage = "url('ico/reg_button_mouseon.png')";
	else
		o.setStyle('background-image', 'url(ico/reg_button_mouseon.png)');	
    //$j('#logoutword').css('color', 'rgb(242, 242, 242)');
}

function logoutup(o)
{
	if (browser.ie)
		o.style.backgroundImage = "url('ico/reg_button_mouseon.png')";
	else
		o.setStyle('background-image', 'url(ico/reg_button_mouseon.png)');	
}

function logoutout(o)
{
	if (browser.ie)
		o.style.backgroundImage = "";
	else
		o.setStyle('background-image', '');	
    //$j('#logoutword').css('color', '#000');
}
